<?php 
$controller = $this->controller;
if (APPLICATION_ENV == "development") {
?>
<script type="text/javascript" src="<?php echo APPLICATION_PUBLIC_PATH?>/js/jquery-1.4.2.js"></script>
<?php
} else {
?>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.3.min.js"></script>
<?php
}

if ($controller == 'index') {
?>
<script src="<?php echo APPLICATION_PUBLIC_PATH?>/js/DD_belatedPNG_0.0.8a.js" mce_src="<?php echo APPLICATION_PUBLIC_PATH?>/js/DD_belatedPNG_0.0.8a.js"></script>
<?php
}

if ($controller == 'foreign' || $controller == 'other' || $controller == 'life') {
?>
<script type="text/javascript">
function changeUrl()
{
	var atags = $('.model-column-inner li a');
    var len = atags.length;
    var href;
    for(var i = 0; i < len; i++) {
        var atag = atags[i];
        href = $(atag).attr('href');
        if (href.indexOf('column') >= 0) {
        	href = href.replace(/column\/+(\d+)/, 'column/' + pictureIndex);
        } else {
        	href = href + '/column/' + pictureIndex;
        }
        $(atag).attr('href', href);
    }
}

var totalLength = 0;
var pictureWidth = 0;
$('.model-column-inner li img').each(function(){
	totalLength += ($(this).width() + 31);
});

var boxWidth = $('.model-column').width();

<?php 
if (!empty($this->column)) {
?>
var pictureIndex = <?php echo $this->column; ?>;
if (boxWidth >= totalLength) {
	$(this).attr('disabled', false);
} else {
	var pictureWidth = 0;
	for (var i = 0; i < pictureIndex; i++) {
		pictureWidth += $('.model-column-inner li img').eq(i).width() + 31;		
	}
	$(".model-column-inner").animate({
		"left" : -pictureWidth
	});
	$(".model-btr-inner").animate({
		"left" : -(pictureWidth + 1080) + 31
	});
	$(".model-btl-inner").animate({
		"left" : -(pictureWidth - 85)
	});
	totalLength -= pictureWidth;
}
changeUrl();
<?php
} else {
?>
var pictureIndex = 0;
<?php 
}
?>
</script>
<?php
}

if ($controller == 'foreign' || $controller == 'other') {
?>
<script src="<?php echo APPLICATION_PUBLIC_PATH?>/js/controllers/list.js"></script>
<?php
} else {
?>
<script type="text/javascript" src="<?php echo APPLICATION_PUBLIC_PATH?>/js/controllers/<?php echo $controller;?>.js?20130710"></script>
<?php
}
?>